<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/**
* @framework : Codeigniter Framework
*
* @author: fatangel26
*
*/

	class Customer_model extends CI_Model
	{
	    protected $_table;

		public function __construct()
		{
			parent::__construct();

            $this->load->database();

            $this->_table = 'tbl_customer';
		}

        /*Basic Method*/

        public function select($data = array())
        {
            if(empty($data))
            {
                $query = $this->db->distinct()
                                  ->get($this->_table);
            }

            if($query->num_rows()>0)
                return $query->result_object();
            return FALSE;
        }

        public function delete($data = array())
        {
            $query = $this->db->delete($this->_table, $data);

            if($this->db->affected_rows()>0)
                return TRUE;
            return FALSE;
        }

        /*Magic Method*/
        public function dels($data = array())
        {
            $count = 0;
            foreach($data as $customer_id)
            {
                if($count == 0)
                    $this->db->where('customer_id', $customer_id);
                else
                    $this->db->or_where('customer_id', $customer_id);
                $count ++;
            }

            $this->db->delete($this->_table);
        }
	}

/* End of file Pages_model.php */
/* Location: ./models/frontend/_model.php */